﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Speciality = Timetable.Site.Host.Speciality.Speciality;

namespace Timetable.Site.Controllers.Api
{
    public class SpecialityController : BaseApiController<Speciality>
    {
        /// <summary>
        /// Возвращает специальности для выбранного факультета
        /// </summary>
        /// <param name="facultyId">Идентификатор факультета</param>
        /// <returns></returns>
        public HttpResponseMessage GetByFaculty(int facultyId)
        {
            return CreateResponse<int, IEnumerable<Speciality>>(privateGetByFaculty, facultyId);
        }

        private IEnumerable<Speciality> privateGetByFaculty(int facultyId)
        {
            return SpecialityService.GetAll(facultyId);
        }
    }
}
